package icu.qx.gbs.service.impl;

import java.util.List;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import icu.qx.gbs.domain.GbsGoodClass;
import icu.qx.gbs.mapper.GbsGoodClassMapper;
import icu.qx.gbs.service.IGbsGoodClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 物品分类Service业务层处理
 *
 * @author ruoyi
 * @date 2024-06-06
 */
@Service
public class GbsGoodClassServiceImpl implements IGbsGoodClassService {
    @Autowired
    private GbsGoodClassMapper gbsGoodClassMapper;

    /**
     * 查询物品分类
     *
     * @param gcId 物品分类主键
     * @return 物品分类
     */
    @Override
    public GbsGoodClass selectGbsGoodClassByGcId(Long gcId) {
        return gbsGoodClassMapper.selectGbsGoodClassByGcId(gcId);
    }

    /**
     * 查询物品分类列表
     *
     * @param gbsGoodClass 物品分类
     * @return 物品分类
     */
    @Override
    public List<GbsGoodClass> selectGbsGoodClassList(GbsGoodClass gbsGoodClass) {
        return gbsGoodClassMapper.selectGbsGoodClassList(gbsGoodClass);
    }

    /**
     * 新增物品分类
     *
     * @param gbsGoodClass 物品分类
     * @return 结果
     */
    @Override
    public int insertGbsGoodClass(GbsGoodClass gbsGoodClass) {
        gbsGoodClass.setCreateBy(SecurityUtils.getUsername());
        gbsGoodClass.setCreateTime(DateUtils.getNowDate());
        return gbsGoodClassMapper.insertGbsGoodClass(gbsGoodClass);
    }

    /**
     * 修改物品分类
     *
     * @param gbsGoodClass 物品分类
     * @return 结果
     */
    @Override
    public int updateGbsGoodClass(GbsGoodClass gbsGoodClass) {
        gbsGoodClass.setUpdateBy(SecurityUtils.getUsername());
        gbsGoodClass.setUpdateTime(DateUtils.getNowDate());
        return gbsGoodClassMapper.updateGbsGoodClass(gbsGoodClass);
    }

    /**
     * 批量删除物品分类
     *
     * @param gcIds 需要删除的物品分类主键
     * @return 结果
     */
    @Override
    public int deleteGbsGoodClassByGcIds(Long[] gcIds) {
        return gbsGoodClassMapper.deleteGbsGoodClassByGcIds(gcIds);
    }

    /**
     * 删除物品分类信息
     *
     * @param gcId 物品分类主键
     * @return 结果
     */
    @Override
    public int deleteGbsGoodClassByGcId(Long gcId) {
        return gbsGoodClassMapper.deleteGbsGoodClassByGcId(gcId);
    }
}
